
export const headerRowStyle = () => {
    return {
        backgroundColor: '#416AB5',
        color: '#fff'
    }
}

export const cellStyle = ({ row, column }) => {
    if (row.meter_code.includes('不明水率') && typeof column.field === 'string' && column.field.includes('usage')) {
        return {
            color: '#F08519',
        }
    }
    else if ((typeof column.field === 'string' && column.field.includes('usage') || column.field === 'sum') && !row.meter_code.includes('不明水率')) {
        return {
            color: '#0D45AC',
        }
    } else {
        return {
            color: '#21333f',
        }
    }
}

export const rowStyle = ({ row, rowIndex }) => {
    let level = row.level;
    switch (level) {
        case 1:
            return {
                backgroundColor: '#AFCAF7',
            }
        case 2:
            return {
                backgroundColor: '#D4E2FF',
            }
        case 3:
            return {
                backgroundColor: '#EBF0FA',
            }
        case 4:
            return {
                backgroundColor: '#F8FAFD',
            }
        default:
            return {
                backgroundColor: '#fff',
            }
    }
}

export const footerRowStyle = ({ row }) => {
    if (row.meter_code === '一级表不明率') {
        return {
            backgroundColor: '#EBF0FA',
            color: '#F08519',
        }
    }
    else {
        return {
            backgroundColor: '#EBF0FA',
            color: '#21333f',
        }
    }
}

export const footerCellStyle = ({ row, column }) => {
    //日抄表专有
    if (typeof column.field === 'string' && column.field.includes('Value')) {
        return {
            color: '#0D45AC',
        }
    }

    if (typeof column.field === 'string' && column.field.includes('meter_code')) {
        return {
            color: '#21333f',
        }
    }

    if (typeof column.field === 'string' && column.field.includes('sum') && row.meter_code !== '一级表不明率') {
        return {
            color: '#0D45AC',
        }
    }

    if (typeof column.field === 'string' && column.field.includes('usage') && row.meter_code !== '一级表不明率') {
        return {
            color: '#0D45AC',
        }
    }
}